package com.chen.pfm.entity;


import ohos.data.orm.OrmObject;
import ohos.data.orm.annotation.Column;
import ohos.data.orm.annotation.Entity;
import ohos.data.orm.annotation.PrimaryKey;
import ohos.data.rdb.ValuesBucket;


@Entity(tableName = "account")
public class Account extends OrmObject {
    @PrimaryKey
    @Column(name = "aid", index = true)
    private String aid;

    @Column(name = "uid", index = true)
    private Integer uid = -1;
    @Column(name = "amoney", index = true)
    private double amoney;

    @Column(name = "cid", index = true)
    private String cid="-1";
    @Column(name = "aremark", index = true)
    private String aremark;

    @Column(name = "artime", index = true)
    private String artime;

    private String actime;

    public Account() {
    }

    public Account(String aid) {
        this.aid = aid;
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public Account(String aid, Integer uid, double amoney, String cid, String aremark, String artime, String actime) {
        this.aid = aid;
        this.uid = uid;
        this.amoney = amoney;
        this.cid = cid;
        this.aremark = aremark;
        this.artime = artime;
        this.actime = actime;
    }
    public Account( Integer uid, double amoney, String cid, String aremark, String artime, String actime) {
        this.uid = uid;
        this.amoney = amoney;
        this.cid = cid;
        this.aremark = aremark;
        this.artime = artime;
        this.actime = actime;
    }

    public String getAid() {
        return aid;
    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public double getAmoney() {
        return amoney;
    }

    public void setAmoney(double amoney) {
        this.amoney = amoney;
    }

    public String getAremark() {
        return aremark;
    }

    public void setAremark(String aremark) {
        this.aremark = aremark;
    }

    public String getArtime() {
        return artime;
    }

    public void setArtime(String artime) {
        this.artime = artime;
    }

    public String getActime() {
        return actime;
    }

    public void setActime(String actime) {
        this.actime = actime;
    }

    @Override
    public String toString() {
        return "Account{" +
                "aid=" + aid +
                ", uid=" + uid +
                ", cid=" + cid +
                ", amoney=" + amoney +
                ", aremark='" + aremark + '\'' +
                ", artime='" + artime + '\'' +
                ", actime='" + actime + '\'' +
                '}';
    }



    public Account getObjectfromValues(ValuesBucket valuesBucket) {
        this.aid = valuesBucket.getString("aid");
        this.uid = valuesBucket.getInteger("uid");
        this.cid = valuesBucket.getString("cid");
        this.amoney = valuesBucket.getDouble("amoney");
        this.aremark = valuesBucket.getString("aremark");
        this.actime = valuesBucket.getString("actime");
        this.artime = valuesBucket.getString("artime");

        return this;
    }

    public ValuesBucket getValuesBucketfromObject() {
        ValuesBucket valuesBucket = new ValuesBucket();
        valuesBucket.putString("aid", aid);
        valuesBucket.putInteger("uid", uid);
        valuesBucket.putString("cid", cid);
        valuesBucket.putDouble("amoney", amoney);
        valuesBucket.putString("aremark", aremark);
        valuesBucket.putString("artime", artime);
        valuesBucket.putString("actime", actime);
        return valuesBucket;
    }

}
